<div class="full-col">
    <div class="title"><?= $co_media['titlemenu' . $hg] ?></div>
    <ul class="news-list media">
            <?php
            $i = 0;
            include_once "library/paging.cls.php";
            $paging = new paging();
            $curpg = $_GET['var2'];
            $curpg = (isset($curpg)) ? $curpg : 1;
            $gotopage = APPLICATION_URL . "media";
            $perpage = 8;
            $pagecount = 10;

            $where_list = "";
            $sql = "select * from media_item $where_list ";

            $query = $db->select($sql);
            $totalrows = $db->numrows($query);
            
            $sql_list = "select * from media_item $where_list order by orderId asc, id asc limit " . (($curpg - 1) * $perpage) . ", " . $perpage;
            $qr_list = $db->select($sql_list);
            $num_list = $db->numrows($qr_list);
            if ($num_list > 0) {
                while ($tt_list = $db->fetch($qr_list)) {
                    $i++;
                    ?>
                    
                    <li class="<?php if ($i % 4 == 0) echo 'last' ?>" >
                        <a class="various fancybox.iframe" href="http://www.youtube.com/embed/<?= getYoutubeIdFromUrl($tt_list['linkto']) ?>?autoplay=1">
                            <div class="image">
                                <img src="http://img.youtube.com/vi/<?= getYoutubeIdFromUrl($tt_list['linkto']) ?>/0.jpg" alt="image" />
                            </div>
                            <div class="tit">
                                <div class="tit"><?= $tt_list['title' . $hg] ?></div>
                            </div>
                            <div class="clear"></div>
                        </a>
                    </li>
                    <?php if ($i % 4 == 0) echo '<div class="clear" />' ?>
                    <?php
                    
                }
            }else {
                __("Media not found");
            }
            ?>

        </ul>
        <div class="clear"></div>
        <div class="paging"><?php echo $paging->pagenew($totalrows, $perpage, $pagecount, $curpg, $gotopage, "", "titlepage"); ?></div>

</div>
